<?=view('admin.common.header')?>
<style>
    .table>tbody>tr>td {vertical-align: middle;}
</style>
<form id="modifyform" action method="post">
<table class="table">
    <?php if ($status == 3): ?>
    <tr>
        <td>上网帐号</td>
        <td>
            <input type="text" name="name" class="form-control" value="" required="required"/>
        </td>
    </tr>
    <tr>
        <td>帐号密码</td>
        <td>
            <input type="text" name="password" class="form-control" value="" required="required"/>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <button class="btn btn-primary form-control eveModify">开　户</button>
        </td>
    </tr>
    <?php elseif ($status == 4): ?>
    <tr>
        <td>上网帐号</td>
        <td>
            <input class="form-control" name="name" value="<?=$order->strNetUser()?>" readonly="">
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <button class="btn btn-primary form-control evexf">续　费</button>
        </td>
    </tr>
    <?php elseif ($status === '0'): ?>
    <tr>
        <td>后台操作优惠</td>
        <td>
            <input type="number" name="adminmod" class="form-control"/>
        </td>
    </tr>
    <tr>
        <td>操作备注</td>
        <td>
            <textarea class="form-control" name="mark"></textarea>
        </td>
    </tr>
    <tr>
        <td colspan="2">
            <button class="btn btn-primary form-control eveyh">确 认</button>
        </td>
    </tr>
    <?php endif; ?>
</table>
    <script>
        $('.eveModify').click(function(){
            var name = $('input[name="name"]').val(), password = $('input[name="password"]').val();
            if (name == '') {
                layer.msg('上网帐号不能为空');
                return false;
            }
            if (name == '') {
                layer.msg('帐号密码不能为空');
                return false;
            }
            $("#modifyform").ajaxSubmit(function(data){
                layer.msg(data.info);
                if (data.status == 1) {
                    window.parent.location.reload();
                }
            });
            return false;
        })
        $('.evexf').click(function(){
            var name = $('input[name="name"]').val();
            if (name == '') {
                layer.msg('续费帐号不能空');
                return false;
            }
            $("#modifyform").ajaxSubmit(function(data){
                layer.msg(data.info);
                if (data.status == 1) {
                    window.parent.location.reload();
                }
            });
            return false;
        });
        $(".eveyh").click(function(){
            var adminmod = $("input[name=adminmod]").val(), mark = $("textarea[name=mark]").val();
            if (isNaN(adminmod) || adminmod == '') {
                layer.msg("没有输入，或者输入不是数字");
                return false;
            }
            if (mark == '') {
                layer.msg("请填写操作备注");
                return false;
            }
            $("#modifyform").ajaxSubmit(function(data){
                layer.msg(data.info);
                if (data.status == 1) {
                    window.parent.location.reload();
                }
            });
            return false;
        });
    </script>
</body>
</html>